package com.ruoyi.quartz.task;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.HigherStatus;
import com.ruoyi.common.enums.TenantStatus;
import com.ruoyi.system.domain.SysTenant;
import com.ruoyi.system.service.ISysTenantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 涨租提醒定时任务 （每年年初重置涨租状态）
 *
 * @author dhk
 */

@Component("higherRemindTask")
public class HigherRemindTask {

    @Autowired
    private ISysTenantService tenantService;

    //每年重置一次涨租状态（修改为未涨租）
    @Log(title = "涨租提醒定时任务执行", businessType = BusinessType.UPDATE)
    public void resetRisePriceStatus(){
        SysTenant sysTenant = new SysTenant();
        sysTenant.setRisePriceStatus(HigherStatus.WAIT.getCode());
        sysTenant.setTenantStatus(TenantStatus.LIVEING.getCode());
        tenantService.updateSysTenantRisePriceStatus(sysTenant);
    }

}
